package com.ffyc.resale.web;

import com.ffyc.resale.model.Result;
import com.ffyc.resale.service.DataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

// 数据统计控制层
@RestController
@RequestMapping(value = "api/data")
public class DataController {


    @Autowired
    DataService dataService;

    // 折线图和柱状图
    @RequestMapping(path = "/goodsBuycountline",method = RequestMethod.GET)
    public Result goodsBuyCountLine(){
        Map<String,Object> map = dataService.goodsBuyCountLine();
        return new Result(200,"查询成功",map);
    }

    // 饼状图
    @RequestMapping(path = "/goodsBuycountpie",method = RequestMethod.GET)
    public Result goodsBuyCountPie(){
        List<Map<String,Integer>> list = dataService.goodsBuyCountPie();
        return new Result(200,"查询成功",list);
    }
}
